<div class='editable-page-model'>
<form id="editable_model_form" action="{$Request.url}">
<div class="dssc-form-goods-pic">
<div class="dssc-goodspic-list">

<ul>
    {for start='0' end='$image_info.count'}
    <li class="dssc-goodspic-upload">
        <div class="upload-thumb"><img src="{if isset($image_info['list'][$i]) && $image_info['list'][$i]['path']}{$image_info['list'][$i]['path']}{else}{:goods_thumb()}{/if}" dstype="file_{$i}">
            <input type="hidden" name="img[{$i}][path]" value="{if isset($image_info['list'][$i]) && $image_info['list'][$i]['path']}{$image_info['list'][$i]['path']}{/if}" dstype="path_{$i}">
        </div>
        <div class="show-sort">{$Think.lang.ds_sort}：
            <input name="img[{$i}][sort]" type="text" class="text" value="{if isset($image_info['list'][$i]) && $image_info['list'][$i]['sort']}{$image_info['list'][$i]['sort']}{else}9{/if}" size="1" maxlength="1">
        </div>
        <div class="dssc-upload-btn"><a href="javascript:void(0);"><span><input type="file" hidefocus="true" size="1" class="input-file" name="file_{$i}" id="file_{$i}" onchange="ajaxFileUpload({$i})"></span><p><i class="iconfont">&#xe733;</i>{$Think.lang.ds_upload}</p>
            </a>
        </div>
    </li>
    {/for}
</ul>
<div class='tc pb20 pt20'><a class="dssc-btn" dstype="select-124" href="javascript:void(0)" onclick="submitEditableModelForm()">{$Think.lang.ds_submit}</a></div>

</div>
</div>
</form>
</div>    
<script>
    
// 图片上传ajax
function ajaxFileUpload(id) {
    $.ajaxFileUpload({
        url : EDITABLE_PAGE_URL+'/image_upload',
        secureuri : false,
        fileElementId : 'file_'+id,
        dataType : 'json',
        data : {name:'file_'+id,config_id : {$Request.param.config_id}},
        success : function (data, status) {
                    if (data.code!=10000) {
                        layer.msg(data.message);
                    } else {
                        $('input[dstype="path_' + id + '"]').val(data.result.file_path);
                        $('input[dstype="id_' + id + '"]').val(data.result.file_id);
                        $('img[dstype="file_' + id + '"]').attr('src', data.result.file_path);
                    }

                }
    });
    return false;

}
</script>

